 function $(id){return document.getElementById(id);}

window.onload = function (){


    /**按钮背景色的切换*/

    $("but1").addEventListener("click",function (){

        this.style.backgroundColor = "#B0B0B0";
        $("but2").style.backgroundColor="#C8C8C8";
        $("mid_1").className = "xian";
        $("bot_1").className = "xian";
        $("mid_2").className = "yin";
        $("bot_2").className = "yin";

    })
    $("but2").addEventListener("click",function (){

        this.style.backgroundColor = "#B0B0B0";
        $("but1").style.backgroundColor="#C8C8C8";
        $("mid_2").className = "xian";
        $("bot_2").className = "xian";
        $("mid_1").className = "yin";
        $("bot_1").className = "yin";

    })

    $("but3").addEventListener("click",function (){
       // this.style.backgroundColor ="#B0B0B0";
        $("bot").className = "xian";
        var car1 = document.getElementById("price").value;

            var myselect=document.getElementById("sel1");
            var index=myselect.selectedIndex;


        var myselect2=document.getElementById("sel2");
        var index2=myselect2.selectedIndex;

 if (index==0&&index2==0)
 {
     $("tab3_1").value=car1*0.8*1000*0.056/12;
     $("tab3_2").value=car1*0.8*1000*0.056/4;
     $("tab3_3").value=car1+car1*0.8*1000*1.056/4;


 }
        if (index==0&&index2==1)
        {
            $("tab3_1").value=car1*0.8*1000*0.056/3;
            $("tab3_2").value=car1*0.8*1000*0.056;
            $("tab3_3").value=car1+car1*0.8*1000*1.056;


        }
        if (index==1&&index2==1)
        {
            $("tab3_1").value=car1*0.7*0.056/12;
            $("tab3_2").value=car1*0.56*0.7*0.056;
            $("tab3_3").value=car1+car1*0.7*0.056/4;


        }
        if (index==1&&index2==0)
        {
            $("tab3_1").value=car1*0.7*0.056/12;
            $("tab3_2").value=car1*0.56*0.7*0.056;
            $("tab3_3").value=car1+car1*0.7*0.056;


        }








        var car2 = document.getElementById("price2").value;



        var obj = document.getElementsByName("sex");
   if (obj[0].checked)
        {
            $("tab4_1").value = car2 * 0.2*1.1;
            $("tab4_2").value = car2 * 0.01*1.1;
            $("tab4_3").value = car2 * 0.03*1.1;
            $("tab4_4").value = car2 * 0.05*1.1;
            $("tab4_5").value = car2 * 0.11*1.1;
        }

        if (obj[1].checked)
        {
            $("tab4_1").value = car2 * 0.2;
            $("tab4_2").value = car2 * 0.01;
            $("tab4_3").value = car2 * 0.03;
            $("tab4_4").value = car2 * 0.05;
            $("tab4_5").value = car2 * 0.11;
        }


    })

    $("span1").addEventListener("click",function (){
        // this.style.backgroundColor ="#B0B0B0";
        window.location.reload();

    })

}


